<?php 
define('PAGE_NEED_PRI','PRI_ADMIN');
session_start();
include("main.php");
?>

<?php
		$webname = 'news';
		
		 $title= isset($_GET["title"])?make_safe($_GET["title"]):'';
		 $isok= isset($_GET["isok"])?make_safe($_GET["isok"]):'';
		 $BigClassName= isset($_GET["BigClassName"])?make_safe($_GET["BigClassName"]):'';
		 $BigClassName2=isset($_GET["BigClassName2"])?make_safe($_GET["BigClassName2"]):'';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> Bios 管理中心 </title>
<link href="../css/control2.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div id="all"><!--Wrap start //-->
<div id="main" class="clearfix"><!--main start //-->
 <?php include_once('top_btn.php');?>
<?php include_once('blog_main_lock_btn.php');?>


  <div id="contact"><!--start contact //-->
  <div class="contact-line">
  	   <?php 
		 
     $action = isset($_REQUEST['action'])?$_REQUEST['action']:'';
    
     switch($action)
     {
     		case 'setstatus':
     			set_status_block();
     			break;
     		case 'del':
     			delete_row_block();
     		break;
     }
    $page_size=10;
    
	$sql="select count(*) as total from ".$webname." where id>0 and `lock`='Y'";
	if($isok != ""){$sql=$sql." and isok='$isok'";}
	
	if($BigClassName!=""){$sql=$sql." and BigClassName='$BigClassName'";}
	if($BigClassName2!=""){$sql=$sql." and BigClassName2='$BigClassName2'";}
	
	if($title!=""){$sql=$sql." and title like '%".$title."%'";}
	/*
	if(isset($_SESSION["box44"]) && $_SESSION["box44"]==1){$sql=$sql." and addname='".$_SESSION["username2"]."'";}
	if(isset($_SESSION["box33"]) &&$_SESSION["box33"]==1){$sql=$sql." and editname2='".$_SESSION["username2"]."'";}
	if(isset($_SESSION["box22"]) &&$_SESSION["box22"]==1){$sql=$sql." and mastereditname='".$_SESSION["username2"]."'";}
	*/
	
	$result=mysql_query($sql);
  $message_count=mysql_result($result,0,"total");
  $page_count=ceil($message_count/$page_size);	
  $offset=($page-1)*$page_size;	
  
  $sql = str_replace('select count(*) as total','select *',$sql);
	
	$sql=$sql."order by id desc limit $offset, $page_size";


  $queryParameter = '';
  if(strlen($BigClassName) > 0)
  {
  		$BigClassName=urlencode($BigClassName);
  		$queryParameter .= sprintf("&BigClassName=%s",$BigClassName);
  		if(strlen($BigClassName2) > 0)
  		{
  				$BigClassName2=urlencode($BigClassName2);
  				$queryParameter .= sprintf("&BigClassName2=%s",$BigClassName2);
  		}
  		if($isok != "")
  		{
  			$queryParameter .= sprintf("&isok=%s",$isok);
  		}
  }	
	$result=mysql_query($sql);
	while ($row=mysql_fetch_object($result)){
	
	$link = sprintf("../%s?id=%d",get_article_page_url_by_type($row->lb),$row->id);
	?>
	<div class="contact-line">
	 <h3>文章標題：<a href="<?php echo $link;?>" target="_blank"><?php echo $row->title;?></a></h3>
		<p>
		 <ul>
		 <li>撰寫時間：<?php echo $row->addtime;?></li>
		 <li>發佈時間：<?php echo $row->senttime;?></li>
		  <li>修改時間：<?php echo $row->edittime;?></li>
		 <li>點閱次數：<?php echo $row->hits;?> </li>
		 <li>讚人數：<?php echo $row->hits;?> </li>
		 <li>回應：1111</li>
		 <li>修改人：aDmin_biOs-pAi</li>
		 </ul>
		</p>
		
		<p>
		 <ul>
		 <li><a href="blog-main-edit.php?id=<?php printf("%d",$row->id); ?>&callbacklink=<?php echo urlencode(sprintf("blog-main.php?page=%d%s",$page,$queryParameter));?>">編輯文章</a></li>
		 <?php if($row->isok == '1'):?>
		 <li><a href="?id=<?php printf("%d",$row->id); ?>&action=setstatus&status=0&page=<?php echo $page;?><?php echo $queryParameter;?>">暫停發佈</a></li>
		 <?php else:?>
			 <li><a href="?id=<?php printf("%d",$row->id); ?>&action=setstatus&status=1&page=<?php echo $page;?><?php echo $queryParameter;?>">恢復發佈</a></li>
		 <?php endif;?>
		 <li><a href="?id=<?php printf("%d",$row->id); ?>&action=del&page=<?php echo $page;?><?php echo $queryParameter;?>"  onclick="javascript:return confirm('刪除文章');">刪除文章</a></li>
		 <li><a href="blog-main-edit_list.php">修改記錄</a></li>
		 </ul>
		</p>
	</div>
<?php }?>
</div>

<div id="contact-page">總共 <?php echo $message_count;?> 篇文章  頁次： 
		<?php 
			  
			  if($page!=1)
			   {
			     echo  "<a href=?page=1".$queryParameter.">首頁</a>&nbsp;&nbsp;&nbsp;";
					 echo "<a href=?page=".($page-1).$queryParameter.">上一頁</a>&nbsp;&nbsp;&nbsp;";
			   } echo $page;?> / <?php echo $page_count;?> 頁&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
         <?php
	  		  
			  if($page<$page_count)
			   {
			        echo "<a href=?page=".($page+1).$queryParameter.">下一頁</a>&nbsp;&nbsp;&nbsp;";
			        echo  "<a href=?page=".$page_count.$queryParameter.">尾頁</a>&nbsp;&nbsp;&nbsp;&nbsp;";
			   
			   }
				   
				 
			?>
			
<script language="javascript">
	function MM_jumpMenu(pageNumber)
	{
		window.location = '?page='+pageNumber + '<?php echo $queryParameter;?>';
	}
</script>
	 跳轉到
  <select name="jumpMenu" id="jumpMenu" onChange="MM_jumpMenu(this.value)">
                 
          <?php 
				 for($i=1;$i<=$page_count;$i++){
				 ?>
          <option value="<?php echo $i;?>" <?php if($page==$i){echo "selected";}?>><?php echo $i;?></option>
          <?php }?>
          </select>頁</div>

  </div><!--end contact //-->
</div><!-- main end //-->
</div><!--Wrap end //-->
<div id="botton">
<?php include_once('botton_btn.php');?>
</div>
</body>
</html>
